package linc.spring.demo;

import linc.spring.demo.bean.AObj;
import linc.spring.demo.bean.BObj;
import linc.spring.demo.bean.CObj;
import org.junit.Test;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yqlin
 * @date 2021/9/7 01:26
 * @description
 */
public class SpringOrderCompareTest {
    @Test
    public void testOrder() {
        AObj aObj = new AObj();
        BObj bObj = new BObj();
        CObj cObj = new CObj();
        List<Object> list = new ArrayList<>();
        list.add(aObj);
        list.add(bObj);
        list.add(cObj);
        System.out.println(list);
        System.out.println("---------------");
        AnnotationAwareOrderComparator comparator = new AnnotationAwareOrderComparator();
        list.sort(comparator);
        System.out.println(list);
    }
}
